﻿<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="ResourceManagement.aspx.cs"
    Inherits="Medianamik.UI.ConfigManagement.ResourceManagement" MasterPageFile="../MasterPages/MedianamikModule.Master"
    ValidateRequest="false" %>

<%@ Import Namespace="Medianamik.Globalization" %>
<%--ValidateRequest="false" est nécessaier pour autoriser les tags HTML dans les traductions--%>
<asp:Content ContentPlaceHolderID="HeaderContentHolder" runat="server">

    <script type="text/javascript">
        function clickOnEnter(e, buttonId) {
            var doClick = false;
            if (window.event) {
                if (e.keyCode == 13)
                    doClick = true;
            }
            else if (e.which == 13) {
                doClick = true;
            }

            if (doClick)
                click(buttonId);
            return false;
        }
        function click(buttonId) {
            var btn = document.getElementById(buttonId);
            if (btn != null) btn.click();
        }
        function openSearchWindow(searchBoxId) {
            var searchBox = document.getElementById(searchBoxId);
            var searchQuery = searchBox.value;
            if (searchQuery) {
                var wnd = GetRadWindowManager().Open('/medianamik/modalwindows/searchresourcewindow.aspx?search=' + searchQuery, 'searchWindow');
            }
        }
    </script>

</asp:Content>
<asp:Content ID="ContextMenuContent" ContentPlaceHolderID="ContextMenu" runat="server">
    <asp:HyperLink ID="lnkAdd" runat="server" Target="addWindow" CssClass="Action BtAjouter"
        NavigateUrl="/medianamik/modalwindows/AddResourceWindow.aspx" onclick="GetRadWindowManager().Open(null, 'addWindow');"
        Text="<%$ Resources: Medianamik_Global,Add %>" />
    <asp:UpdatePanel ID="deleteLinkPanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <contenttemplate>
            <asp:LinkButton ID="btnSave" runat="server" CssClass="Action BtSauvegarder" OnClick="btnSave_Click" Text="<%$ Resources : Medianamik_Global, SaveButtonText %>" />
            <asp:HyperLink ID="lnkDelete" runat="server" Target="deleteWindow" class="Action BtSupprimer" onclick="GetRadWindowManager().Open(null, 'deleteWindow');" Text="<%$ Resources: Medianamik_Global,Delete %>" />
            <asp:LinkButton ID="btnRefresh" runat="server" CssClass="Action BtRefresh" OnClick="btnRefresh_Click" Text="Actualiser" />
        </contenttemplate>
    </asp:UpdatePanel>
    <asp:HyperLink ID="lnkImport" runat="server" Target="importWindow" CssClass="Action BtSauvegarder"
        NavigateUrl="/medianamik/modalwindows/ImportResourceWindow.aspx" onclick="GetRadWindowManager().Open(null, 'importWindow');"
        Text="<%$ Resources: Medianamik_ResourceManagement,ImportResource %>" />
    <asp:HyperLink ID="lnkExport" runat="server" Target="ExportWindow" CssClass="Action BtSauvegarder"
        NavigateUrl="/medianamik/modalwindows/ExportResourcesWindow.aspx" onclick="GetRadWindowManager().Open(null, 'ExportWindow');"
        Text="<%$ Resources: Medianamik_ResourceManagement, ExportResource %>" />
    <asp:LinkButton ID="lnkImportResX" OnClick="lnkImportResX_OnClick" runat="server"
        CssClass="Action BtSauvegarder" Text="<%$ Resources: Medianamik_ResourceManagement,ImportResXResource %>" />
    <asp:LinkButton ID="lnkExportResX" OnClick="lnkExportResX_OnClick" runat="server"
        CssClass="Action BtSauvegarder" Text="<%$ Resources: Medianamik_ResourceManagement, ExportResXResource %>" />
</asp:Content>
<asp:Content ID="CenterContent" ContentPlaceHolderID="CenterContent" runat="server">
    <asp:UpdatePanel runat="server" ID="upl" ChildrenAsTriggers="true" UpdateMode="Conditional">
        <contenttemplate>
            <asp:Literal ID="litError" runat="server" Text="" EnableViewState="false" Visible="false" />
            <asp:PlaceHolder ID="phrMain" runat="server" Visible="false">
                <table border="0" cellpadding="0" cellspacing="0" width="95%">
                    <tr valign="top">
                        <td width="40%" valign="top">
                            <h3><%=Resources("Medianamik_ResourceManagement", "ResourceSets") %></h3>
                            <div><asp:TextBox ID="txtSearchResources" runat="server" Width="67%"></asp:TextBox>&nbsp;
                            <asp:Button ID="btnSearchResources" runat="server" Text="<%$ Resources: Medianamik_Global, SearchBox_SearchLabel %>" Width="26%" /></div>
                            <p>
                                <asp:RadioButtonList ID="Filters" runat="server" RepeatDirection="Horizontal" RepeatLayout="Table" AutoPostBack="true" OnSelectedIndexChanged="ChangeFilter">
                                    <asp:ListItem Text="<%$ Resources : Medianamik_ResourceManagement, AllResources %>" Value="all" Selected="True" />
                                    <asp:ListItem Text="<%$ Resources : Medianamik_ResourceManagement, NonTranslated %>" Value="notrans" />
                                </asp:RadioButtonList>
                                <br/>
                            </p>
                            <p>
                                <asp:DropDownList runat="server" ID="lstResourceSet" Width="70%" AutoPostBack="True" OnSelectedIndexChanged="lstResourceSet_SelectedIndexChanged" />
                                &nbsp;&nbsp;&nbsp;
                                <asp:Button ID="btnRefreshResourceSet" runat="server" style="" CssClass="Btn" OnClick="btnRefreshResourceSet_OnClick" Text="<%$ Resources : Medianamik_ResourceManagement, RefreshResourceSet %>" />
                            </p>
                            <p><asp:ListBox runat="server" ID="lstResourceIds" Width="95%" Height="250" AutoPostBack="true" OnSelectedIndexChanged="lstResourceIds_SelectedIndexChanged" /></p>
                        </td>
                        <td width="20%"><img src="/medianamik/images/spacer.gif" width="16" height="1" alt="&nbsp;" /></td>
                        <td width="40%" valign="top">
                            <h3><%=Resources("Medianamik_ResourceManagement", "ValueFor") %>:&nbsp;<asp:Label ID="lblCurrentResourceId" runat="server"></asp:Label></h3>
                            <p><asp:TextBox ID="txtResource" runat="server" Width="95%" TextMode="MultiLine" Rows="8" /></p>
                            <p><asp:CheckBox ID="ckLocalResource" runat="server" Text="<%$ Resources : Medianamik_ResourceManagement, LocalResource %>" /></p>
                            <asp:PlaceHolder ID="phLastContextUsed" runat="server">
                            <h3><%=Resources("Medianamik_ResourceManagement", "LastContext") %></h3>
                            <p><asp:Literal ID="litLastContext" runat="server" /></p>
                            </asp:PlaceHolder>
                        </td>
                    </tr>
                </table>
                <fieldset class="Colonne">
                </fieldset>
                <div class="clear">
                </div>
            </asp:PlaceHolder>
            <asp:HiddenField ID="reloadType" runat="server" />
        </contenttemplate>
    </asp:UpdatePanel>
</asp:Content>
<asp:Content ID="ExternalContent" ContentPlaceHolderID="ExternalContentHolder" runat="server">
    <telerik:radscriptblock runat="server" id="scriptBlock">

        <script type="text/javascript">
            //<![CDATA[

            function modalWindowCallback(radWindow, returnValue) {
                if (returnValue) {
                    var argument = returnValue.get_argument();
                    if (argument && argument.reloadType &&
                    (argument.reloadType == 'ReloadResourceIDs' ||
                        argument.reloadType == 'ReloadResourceSets' ||
                        argument.reloadType == 'ReloadValue' ||
                        argument.reloadType.indexOf("LoadResource") != -1)) {

                        __doPostBack('<%= reloadType.ClientID %>', argument.reloadType);
                    }
                }
            }

            //]]>
        </script>

    </telerik:radscriptblock>
</asp:Content>
